package com.community.web.user.controller.wallet;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.community.common.login.LoginUserHolder;
import com.community.common.result.Result;
import com.community.model.entity.PortalWalletLog;
import com.community.web.user.service.PortalWalletLogService;
import com.community.web.user.vo.WalletLogQueryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "记录模块")
@RestController
@RequestMapping("/user/log")
public class PortalWalletLogController {

    @Autowired
    private PortalWalletLogService service;

    @ApiOperation("根据条件分页查询消费记录列表")
    @GetMapping("{current}/{size}")
    public Result<IPage<PortalWalletLog>> pageList(@PathVariable long current, @PathVariable long size, WalletLogQueryVo queryVo){
        Page<PortalWalletLog> page = new Page<>(current, size);
        Long userId = LoginUserHolder.getLoginUser().getUserId();
        IPage<PortalWalletLog> result = service.pageList(userId, page, queryVo);
        return Result.ok(result);
    }
}
